<template>
	<view>
		<view class="staff-list">
			<view class="staff-item row" @click="showStaffPage(staff.id)" v-for="(staff,key) in staffs" :key="key">
				<view class="staff-avatar">
					<image :src="staff.avatar" mode="" class="staff-avatar-image"></image>
				</view>
				<view class="staff-info">
					<view class="staff-column" style="flex: 1;">
						<view class="staff-name">
							{{staff.nickname}}
						</view>
						<view class="staff-star">
							<block v-for="i in 5" :key="i">
								<image src="../../../static/star.png" mode="" style="width: 40upx;height: 40upx;" v-if="i<=staff.score-1"></image>
								<image src="../../../static/star-line.png" mode="" style="width: 40upx;height:40upx;" v-else></image>
							</block>
						</view>
					</view>
					<view class="staff-column">
						<view class="staff-count">
							已服务{{staff.service_count}}次
						</view>
						<view class="staff-order row" @click.stop="choose(staff.id)">
							立即预约
						</view>
					</view>
					
				</view>
				
			</view>
			
		</view>
	</view>
</template>

<script>
	import uniIcon from '../../../components/uni-icon.vue'
	export default {
		
		components: {
			uniIcon,
		},
		data() {
			return {
				service_id:0,
				store_id:0,
				staffs:[],
				pay_type:0,
				card_item_id:0,
			};
		},
		onLoad:function(e){
			this.service_id=e.service_id;
			this.store_id=e.store_id;
			this.pay_type=e.pay_type;
			this.card_item_id=e.card_item_id;
			this.getStaffs();
		},
		methods:{
			choose:function(id){
				uni.navigateTo({
					url:"/pages/service/booking/booking?store_id="+this.store_id+"&staff_id="+id+"&service_id="+this.service_id+"&pay_type="+this.pay_type+"&card_item_id="+this.card_item_id,
				})
			},
			getStaffs:function(){
				var that=this;
				that.ajax("/store/staffs",{
					store_id:this.store_id,
				},function(res){
					that.staffs=res.data.data;
				});
			}
		}
	}
</script>

<style>
	.row{
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.staff-list{
		margin-top: 32upx;
		padding: 20upx;
	}
	.staff-item{
		position: relative;
		margin-bottom: 75upx;
		padding:0 20upx;
	}
	.staff-avatar{
		position: relative;
		width: 160upx;
		height: 160upx;
		z-index: 100;
	}
	.staff-avatar-image{
		width: 160upx;
		height: 160upx;
		border-radius: 12upx;
	}
	.staff-info{
		display: flex;
		flex-direction: row;
		position: absolute;
		height: 182upx;
		left: 80upx;
		top: -24upx;
		right: 28upx;
		padding-left: 120upx;
		border-radius: 12upx;
		background: #ffffff;
		box-shadow:0upx 2upx 20upx 0upx rgba(43,159,133,0.14);
		padding-right: 14upx;
		padding-bottom: 24upx;
	}
	.staff-column{
		display: flex;
		flex-direction: column;
		height: 100%;
		align-content: center;
		justify-content: center;
	}
	.staff-name{
		font-size: 28upx;
		color:#4B4B4B;
	}
	.staff-star{
		margin-top: 10upx;
		display: flex;
		height: 40upx;
	}
	.staff-count{
		font-size: 24upx;
		color: #ababab;
		margin-top: 50upx;
		text-align: right;
	}
	.staff-order{
		font-size: 24upx;
		color: #ffffff;
		background: #45AA8C;
		padding: 14upx 24upx;
		border-radius:8upx;
		margin-top: 46upx;
	}
</style>
